package 线程的学习;

public class TestThread1 {
    public static void main(String[] args) {
        MyThrea1 T=new MyThrea1();
        Thread t=new Thread(T);
        t.start();
        for(int i=0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+":"+i);
            try{
                Thread.sleep(100);
            }catch (InterruptedException e){
                throw new RuntimeException(e);
            }
        }

    }


}
class MyThrea1 implements Runnable{
    public void run(){
        for(int i=0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+":"+i);
            try{
                Thread.sleep(100);
            }catch (InterruptedException e){
                throw new RuntimeException();
            }
        }
    }

}